-- <movevent type="AddItem" tileitem="1" itemid="1423-1425" event="script" value="RPG/firecamp.lua"/>
local burningItems = {2544, 2120, 2597, 2598, 2599, 5878, 7729, 2461, 2467, 2650, 2651, 2652, 2649, 2642, 2643, 1988, 1987, 1947}
local feedFireCamp = {5901, 2512, 2250, 2251, 2252, 2253, 2254, 2255, 2382}

function onAddItem(moveitem, tileitem, position, cid)
	--- dodaj ksiazki
	if (isInArray(burningItems, moveitem.itemid) or isInArray(feedFireCamp, moveitem.itemid)) then
		doRemoveItem(moveitem.uid)
		
		if isInArray(feedFireCamp, moveitem.itemid) == true then
			if tileitem.itemid ~= 1423 then
				addEvent(function()
							position.stackpos = 1
							doTransformItem(getThingFromPos(position).uid, tileitem.itemid -1)
						end, 500)
				
			else
				addEvent(function()
							position.stackpos = 1
							doRemoveItem(getThingFromPos(position).uid)
							doCreateItem(1423, 0, position)
						end, 500)
			end
		end
		
		doSendMagicEffect(position, CONST_ME_HITBYFIRE)
	end
	return true
end